﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Yipusoft.WorkTaskGrade.BLL;
using Yipusoft.WorkTaskGrade.Model;

public partial class Task_WorkTask_WorkTaskView : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            Bind();
    }

    private void Bind()
    {
        if (Request["ID"] == null)
            return;

        Yipusoft.WorkTaskGrade.Model.WorkTaskGradeInfo model = new Yipusoft.WorkTaskGrade.BLL.WorkTaskGrade().GetDetail(new Guid(Request["ID"]));
        if (model == null)
            return;

        this.lblTaskDate.Text = model.IsYear == 1 ? model.TaskDate.Year + "年" : model.TaskDate.ToString("yyyy年M月");
        this.lblDepartmentID.Text = Yipusoft.Account.BLL.Department.GetDepartment(model.DepartmentID).ShortName;
        this.lblWorkTask.Text = model.WorkTask;
        this.lblMarking.Text = model.Marking.ToString();
        this.lblCompleteCircs.Text = model.CompleteCircs;
        this.lblBonusPoint.Text = model.BonusPoint.ToString();
        this.lblSimpleCircs.Text = model.SimpleCircs;
        this.SelfScore.Text = model.SelfScore.ToString().Equals("-1") ? "未评分" : model.SelfScore.ToString();
        this.lblReMark.Text = model.ReMark;

        if (model.ApproveScore == -1)
        {
            this.ApproveScore.Text = "未评分";


        }
        else
        {
            this.ApproveScore.Text = model.ApproveScore.ToString();

        }

        if (model.Score == -1)
        {
            this.lblScore.Text = "未评分";


        }
        else
        {
            this.lblScore.Text = model.Score.ToString();

        }

        dl.DataSource = WorkTaskItem.GetList(" taskId='" + Request["ID"] + "' ");
        dl.DataBind();
    }
   
    protected void dl_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            Label lblTask = e.Item.FindControl("lblTask") as Label;
            WorkTaskItemInfo Info = e.Item.DataItem as WorkTaskItemInfo;
            lblTask.Text = e.Item.ItemIndex + 1 + "、" + Info.ItemContent + Info.Circs;

        }
    }
}
